# 
# To change this template, choose Tools | Templates
# and open the template in the editor.
 

class TcidUtility
  def initialize
    
  end
  
  def self.set_register_subject(register_subject)
    save_path = "#{RAILS_ROOT}/public/admin"
    FileUtils.makedirs(save_path) if !File.exist?(save_path)
    fout = File.open(save_path+"/register_subject.txt", "w");
    fout.puts register_subject
    fout.close
  end
  
  def self.get_register_subject
    register_subject = ""
    begin
      output =  []
      File.open("#{RAILS_ROOT}/public/admin/register_subject.txt") do |file|
        while line = file.gets
          output.push(line)
        end
      end
      register_subject = output.join("").to_s
    rescue
      register_subject = ""
    end
    return register_subject
  end
  
  def self.set_register_body(register_body)
    save_path = "#{RAILS_ROOT}/public/admin"
    FileUtils.makedirs(save_path) if !File.exist?(save_path)
    fout = File.open(save_path+"/register_body.txt", "w");
    fout.puts register_body
    fout.close
  end
  
  def self.get_register_body
    register_body = ""
    begin
      output =  []
      File.open("#{RAILS_ROOT}/public/admin/register_body.txt") do |file|
        while line = file.gets
          output.push(line)
        end
      end
      register_body = output.join("").to_s
    rescue
      register_body = ""
    end
    return register_body
  end
  
  def self.set_forgot_password_subject(forgot_password_subject)
    save_path = "#{RAILS_ROOT}/public/admin"
    FileUtils.makedirs(save_path) if !File.exist?(save_path)
    fout = File.open(save_path+"/forgot_password_subject.txt", "w");
    fout.puts forgot_password_subject
    fout.close
  end
  
  def self.get_forgot_password_subject
    forgot_password_subject = ""
    begin
      output =  []
      File.open("#{RAILS_ROOT}/public/admin/forgot_password_subject.txt") do |file|
        while line = file.gets
          output.push(line)
        end
      end
      forgot_password_subject = output.join("").to_s
    rescue
      forgot_password_subject = ""
    end
    return forgot_password_subject
  end
  
  def self.set_forgot_password_body(forgot_password_body)
    save_path = "#{RAILS_ROOT}/public/admin"
    FileUtils.makedirs(save_path) if !File.exist?(save_path)
    fout = File.open(save_path+"/forgot_password_body.txt", "w");
    fout.puts forgot_password_body
    fout.close
  end
  
  def self.get_forgot_password_body
    forgot_password_body = ""
    begin
      output =  []
      File.open("#{RAILS_ROOT}/public/admin/forgot_password_body.txt") do |file|
        while line = file.gets
          output.push(line)
        end
      end
      forgot_password_body = output.join("").to_s
    rescue
      forgot_password_body = ""
    end
    return forgot_password_body
  end
end
